﻿using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace Bombardiman
{
    public class Character: AnimatedGameObject
    {
        private int health;
        private Motion motion;

        public Character()
            :base()
        {}

        public void Initialize(Texture2D texture, Vector2 position, bool active, int width, int height, Animation animation, 
            int health, Motion motion)
        {
            base.Initialize(texture, position, active, width, height, animation);

            this.health = health;
            this.motion = motion;
        }
        public int getHealth()
        {
            return health;
        }
        public Motion getMotion()
        {
            return motion;
        }
        public void setMotion(Motion motion)
        {
            this.motion = motion;
        }
        public void setHealth(int health)
        {
            this.health = health;
        }
        public float getSpeed()
        {
            return motion.speed;
        }
        public void moveLeft()
        {
            getAnimation().setDirection(0);
            setPosition(new Vector2(getPosition().X - getSpeed(), getPosition().Y));
        }
        public void moveRight()
        {
            getAnimation().setDirection(1);
            setPosition(new Vector2(getPosition().X + getSpeed(), getPosition().Y));
        }
        public void moveUp()
        {
            getAnimation().setDirection(2);
            setPosition(new Vector2(getPosition().X, getPosition().Y - getSpeed()));
        }
        public void moveDown()
        {
            getAnimation().setDirection(3);
            setPosition(new Vector2(getPosition().X, getPosition().Y + getSpeed()));
        }
    }
}
